package cn.edu.tju.elm.repository;

import cn.edu.tju.elm.model.DeliveryAddress;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

/**
 * ClassName: AddressRepository
 * Package: cn.edu.tju.elm.repository
 * Description:
 *
 * @Author Niu Wenhang
 * @Create 2025/9/17 20:26
 * @Version 1.0
 */
public interface AddressRepository extends JpaRepository<DeliveryAddress, Long> {
    List<DeliveryAddress> findByCustomerIdAndDeletedFalse(Long customerId);
    
    // 根据地址内容模糊查询
    List<DeliveryAddress> findByAddressContainingAndCustomerIdAndDeletedFalse(String address, Long customerId);
    
    // 根据联系人姓名模糊查询
    List<DeliveryAddress> findByContactNameContainingAndCustomerIdAndDeletedFalse(String contactName, Long customerId);
    
    // 根据联系电话精确查询
    List<DeliveryAddress> findByContactTelAndCustomerIdAndDeletedFalse(String contactTel, Long customerId);
}
